package com.example.filesynsystem.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

@Data
public class JSONResult {

    //响应业务状态
    private Integer status;

    // 响应消息
    private String msg;

    // 响应数据
    private Object data;

    @JsonIgnore
    private String ok;

    public static JSONResult ok(Object data) {return new JSONResult(data);}

    public static JSONResult ok() {return new JSONResult(null);}

    public static JSONResult build(Integer status, String msg, Object data) {
        return new JSONResult(status, msg, data);
    }

    public JSONResult(Integer status, String msg, Object data) {
        this.status = status;
        this.msg = msg;
        this.data = data;
    }

    public JSONResult(Integer status, String msg, Object data, String ok) {
        this.status = status;
        this.msg = msg;
        this.data = data;
        this.ok = ok;
    }

    public JSONResult() {

    }

    public JSONResult(Object data) {
        this.status = 200;
        this.msg = "OK";
        this.data = data;
    }
}
